junco_vulcani <-
st_read(
"https://raw.githubusercontent.com/gf0604-procesamientodatosgeograficos/2021i-datos/main/gbif/junco_vulcani-cr-registros.csv",
options = c(
"X_POSSIBLE_NAMES=decimalLongitude",
"Y_POSSIBLE_NAMES=decimalLatitude"
),
quiet = TRUE
)
# Asignación de CRS
st_crs(junco_vulcani) = 4326
# Capa Geoespacila de cantones
cantones <-
st_read(
"https://raw.githubusercontent.com/gf0604-procesamientodatosgeograficos/2021i-datos/main/ign/delimitacion-territorial-administrativa/cr_cantones_simp_wgs84.geojson",
quiet = TRUE
)
# Cruce espacial con la tabla de cantones, para obtener el nombre del cantón
junco_vulcani <-
junco_vulcani %>%
st_join(cantones["canton"])
El junco de los páramos (junco culcani) habita en zonas abiertas en enleavciones altas, usualmente por encima de los 3000 metros. Suele posarse sobre el suelo o en pequeños arbustos, generalemnete en parejas o en grupos pequeños. Su rango es muy limitado: solo en Costa Rica o en el extremo oeste de Panamá (eBird, Junco culcani)
# Tabla de registros de presencia
junco_vulcani %>%
st_drop_geometry() %>%
select(stateProvince, canton, locality, eventDate) %>%
datatable(
colnames = c("Provincia", "Cantón", "Localidad", "Fecha"),
options = list(searchHighlight = TRUE)
)
# Gráfico de estacionalidad
junco_vulcani %>%
st_drop_geometry() %>%
group_by(mes = format(as.Date(eventDate, "%Y-%m-%d"), "%m")) %>%
summarize(suma_registros = n()) %>%
filter(!is.na(mes)) %>%
plot_ly(
x = ~ mes,
y = ~ suma_registros,
fill = "tozeroy",
type = "scatter",
marker = list(size = 10,
color = "orange"),
fillcolor = "grey"
) %>%
layout(
title = "Estacionalidad",
xaxis = list(title = "Mes"),
yaxis = list(title = "Cantidad de registros")
)
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
junco_vulcani %>%
st_drop_geometry() %>%
group_by(anio = format(as.Date(eventDate, "%Y-%m-%d"), "%Y")) %>%
summarize(suma_registros = n()) %>%
filter(!is.na(anio)) %>%
filter(anio >= 2011) %>%
plot_ly(
x = ~ anio,
y = ~ suma_registros,
type = "bar",
color = "orange"
) %>%
layout(
title = "Historial",
xaxis = list(title = "Años"),
yaxis = list(title = "Cantidad de registros")
)
# Mapa de registros de presencia
junco_vulcani %>%
select(stateProvince,
canton,
locality,
eventDate) %>%
leaflet() %>%
addProviderTiles(providers$OpenStreetMap.Mapnik, group = "OpenStreetMap") %>%
addProviderTiles(providers$Stamen.TonerLite, group = "Stamen Toner Lite") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "Imágenes de ESRI") %>%
addCircleMarkers(
stroke = F,
radius = 4,
fillColor = 'orange',
fillOpacity = 1,
popup = paste(
junco_vulcani$stateProvince,
junco_vulcani$canton,
junco_vulcani$locality,
junco_vulcani$eventDate,
sep = '<br/>'
),
group = "Junco del páramo (Junco Vulcani)"
) %>%
addLayersControl(
baseGroups = c("OpenStreetMap", "Stamen Toner Lite", "Imágenes de ESRI"),
overlayGroups = c("Junco del páramo (Junco Vulcani)")
) %>%
addMiniMap(
tiles = providers$Stamen.OpenStreetMap.Mapnik,
position = "bottomleft",
toggleDisplay = TRUE
)